<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
       function fun(){
           alert(arguments.length);//可看参数个数
           alert(arguments[0]);
           alert(arguments[1]);
           alert(arguments[2]);
           for (var i=0;i<arguments.length;i++){
               alert(arguments[i]);
           }

       }
//需求：编写一个函数，用于计算所有参数相加和并返回
       function sum(a,b){
           var result=0;
           for(var i=0;i<arguments.length;i++){
               if(typeof arguments[i]=="number"){
                   result+=arguments[i];
               }

           }
           return result;

       }
       fun(1,"abc",true)

    </script>
</head>
<body>

</body>
</html>